package com.xja.shoppingmall.comfig;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author CHENCHEN
 * @title  配置类，读取Nacos相关的配置项，用于配置监听器
 * @createTime 2021-12-1110:34
 */
@Configuration
public class GatewayConfig {

    //读取配置超时时间
    public static final long DEFAULT_TIMEOUT = 30000;

    //Nacos服务器地址
    public static String NCOS_SERVER_ADDR;

    //命名空间
    public static String NACOS_NAMESPACE;

    //data_id
    public static String NACOS_ROUTE_DATA_ID;

    //分组ID
    public static String NACOS_ROUTE_GROUP;

    @Value("${spring.cloud.nacos.discovery.server-addr}")
    public void setNcosServerAddr(String ncosServerAddr){
        NCOS_SERVER_ADDR = ncosServerAddr;
    }

    @Value("${spring.cloud.nacos.discovery.namespace}")
    public void setNacosNamespace(String nacosNamespace){
        NACOS_NAMESPACE = nacosNamespace;
    }

    @Value("${nacos.gateway.route.config.data-id}")
    public void setNacosRouteDataId(String nacosRouteDataId){
        NACOS_ROUTE_DATA_ID = nacosRouteDataId;
    }

    @Value("${nacos.gateway.route.config.group}")
    public void setNacosRouteGroup(String nacosRouteGroup){
        NACOS_ROUTE_GROUP = nacosRouteGroup;
    }
}
